package cn.gson.work.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.util.Objects;

@Entity
public class Trecord {
    private long rno;
    private Time bdate;
    private Dossier dossier;

    @Id
    @Column(name = "RNO")
    public long getRno() {
        return rno;
    }

    public void setRno(long rno) {
        this.rno = rno;
    }

    @Basic
    @Column(name = "BDATE")
    public Time getBdate() {
        return bdate;
    }

    public void setBdate(Time bdate) {
        this.bdate = bdate;
    }

    @ManyToOne
    @JoinColumn(name="RSNO")
    public Dossier getDossier() {
        return dossier;
    }

    public void setDossier(Dossier dossier) {
        this.dossier = dossier;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Trecord trecord = (Trecord) o;
        return rno == trecord.rno &&
                Objects.equals(bdate, trecord.bdate);
    }

    @Override
    public String toString() {
        return "Trecord{" +
                "rno=" + rno +
                ", bdate=" + bdate +
                ", dossier=" + dossier +
                '}';
    }

    @Override
    public int hashCode() {
        return Objects.hash(rno, bdate);
    }
}
